package com.ls.controller.seating;

import com.ls.controller.rule.model.AddRuleModel;
import com.ls.controller.rule.model.EditRuleModel;
import com.ls.controller.rule.model.QueryRuleModel;
import com.ls.controller.seating.model.AddSeatingModel;
import com.ls.controller.seating.model.EditIndexModel;
import com.ls.controller.seating.model.EditSeatingModel;
import com.ls.service.ISeatingService;
import com.ls.utils.ResultData;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * @ClassName SeatingAppController
 * @Description app场地控制器
 * <p>
 * 场地
 * APP专用接口
 * </p>
 *
 * @author pengyu
 * @since 2024-06-28
 */
@Api(value = "app场地相关接口", tags = "app场地相关接口")
@RestController
@RequiredArgsConstructor
@RequestMapping("/seatingApp")
public class SeatingAppController {
    private final ISeatingService service;


    /**
     * 新增场地
     */
    @PostMapping(value = "add")
    public ResultData add(@Valid @RequestBody AddSeatingModel model) {
        return service.add(model);
    }

    /**
     * 编辑场地
     */
    @PostMapping(value = "edit")
    public ResultData edit(@Valid @RequestBody EditSeatingModel model) {
        return service.edit(model);
    }

    /**
     * 删除场地
     */
    @PostMapping(value = "del")
    public ResultData del(@RequestParam Long seatingId) {
        return service.del(seatingId);
    }
    /**通过id查询场地*/
    @GetMapping(value = "getById")
    public ResultData getById(@RequestParam Long seatingId) {
        return service.getSeatingById(seatingId);
    }
    
    /**获取当前用户的场地列表*/
    @GetMapping(value = "list")
    public ResultData getList() {
        return service.getSeatingList();
    }
    /**编辑场地排序*/
    @PostMapping(value = "editIndex")
    public ResultData editIndex(@RequestBody EditIndexModel model) {
        return service.editIndex(model);
    }
}
